The present invention relates to a buffer, especially to a reset system for a buffer and a method thereof.
Streaming Systems are applied to network for listening to broadcast, playing music or watching movies. The streaming system basically includes a plurality of processing units and a plurality of buffers. A buffer used to store data temporarily is disposed between two contiguous processing units. Please refer to FIG. 1, a conventional streaming system applied to internet includes a first processing unit 20′, a second processing unit 22′, a third processing unit 24′, a fourth processing unit 26′, a first buffer 30′ and a second buffer 32′. The first processing unit 20′ is for downloading data and saving the data into the first buffer 30′. According to the data type inside the first buffer 30′ such as MP3(Moving Picture Experts Group 1 Audio Layer 3), WMA(Windows Media audio), or WMV(Windows Media Video), the second processing unit 22′ and the third processing unit 24′ are respectively used to deal with data inside the first buffer 30′. The second processing unit 22′ reads d at a inside the first buffer 30′, processes the data, and then the processed data is saved into the second buffer 32′. If the second processing unit 22′ is unable to process the data from the first buffer 30′, then the system may be reset and the process restarted using the third processing unit 24′ to read the data inside the first buffer 30′, process the data, and then the processed data is saved into the second buffer 32′. Next, the fourth processing unit 26′reads the processed data from the second buffer 32′ for display. The first buffer 30′ and the second buffer 32 ′ are ring buffers with character of FIFO (First In First Out).
Refer to FIG. 2A, the buffer 1′ includes a start pointer 5′ and an end pointer 7′, respectively indicating starting positions and end position of the data 10′ inside the buffer 1′. When data is read from the buffer, it is read from the start pointer 5′, which then moves forward. When data is written to the buffer it is written after the end pointer 7′, which then moves forward.
Moreover, refer to FIG. 2B, when the data 10′ in the buffer 1′ has been read, the start pointer 5′ moves forwards to a last position that has been read. Once the data 10′ has all been read, the start pointer 5′ points to the same position as the end pointer 7′ points. Then a data 12′ is saved into the buffer 1′, the data 12′ is written in from the position that the end pointer 7′ points and the end pointer 7′ moves forwards until all the data 12′ has been written into the buffer 1′. When the data 12′ is written to the last position in the buffer while it's still not finished, the end pointer 7′ moves back to the beginning of the buffer 1′ for continuing writing rest of the data 12′. Thus the data 10′ that has been read is overwritten now. Therefore, such kind of buffer 1′ is called ring buffer.
Back to FIG. 1, if the second processing unit 22′ can't process data of the first buffer 30′, it would be desirable for the third processing unit 24′ to try to read and process the data of the first buffer 30′. However the start address 5′ has moved forward to the last position that has been read by the second processing unit 22′, so the third processing unit 24′ is unable to read original data in the first buffer 30′. Thus, we would need to reset the whole system and restart first processing unit 20′ to allow the third processing unit 24′ to process data.